<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@page import="java.util.*" %>
<%@page import="com.cn.web.entity.GoodsEntity" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>商品展示</title>
<script type="text/javascript">
	function queryGood(){
		
	}
	function addGood(){
		//alert("111");
		window.location.href("/yuhaitao/GoodAdd.jsp");
		
	}
</script>
</head>
<body>
<center>
	<fieldset>
		<legend>条件查询</legend>
		<form action="GoodsController">
	    	商品名称：<input type="text" name="goodName" id="goodName"/>
	    	商品货号：<input type="text" name="goodCode" id="goodCode"/>
	    	<input type="hidden" name="btnName" value="query">
	    	&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="模糊查询" onclick="queryGood()">	      
        </form>   

	</fieldset>
	<br><div align="left"><input type="button" value="添加商品" onclick="addGood()"/></div><br>
	<table border="1" width="100%">
		<thead>
			<tr>
				<th>商品名称</th>
				<th>商品货号</th>
				<th>商品库存</th>
				<th>商品属性</th>
				<th>商品成本</th>
				<th>商品卖价</th>
				<th>商品发布时间</th>
				<th colspan="2">操作</th>
			</tr>
		</thead>
		<tbody>
			<% 
			List<GoodsEntity> goodList = (List)request.getAttribute("goodList");
			if(goodList==null || goodList.isEmpty()){
				goodList = new ArrayList<GoodsEntity>();
			}	
			Iterator<GoodsEntity> iter = goodList.iterator();//迭代器
			while(iter.hasNext()){
				GoodsEntity good =	iter.next();%>
				<tr>
				<td><%=good.getGoodsName() %></td>
				<td><%=good.getGoodsCode() %></td>
				<td><%=good.getGoodsStock() %></td>
				<td><%=good.getGoodsProperty() %></td>
				<td><%=good.getGoodsPrice() %></td>
				<td><%=good.getGoodsMarketPrice() %></td>
				<td><%=good.getGoodsIssue() %></td>
				<td><a href="/yuhaitao/GoodsController?goodName=<%=good.getGoodsName() %>&btnName=edit">编辑</a></td>
				<td><a href="/yuhaitao/GoodsController?goodName=<%=good.getGoodsName() %>&btnName=del">删除</a></td>
			</tr>
		<% 	}%>
		</tbody>
	</table>
</center>
</body>
</html>